package com.matrix.java.chap_06;

import java.util.Scanner;

/*
    对三个数排序
 */
public class Ex6_05 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("输入三个整数: ");
        double num1 = input.nextDouble();
        double num2 = input.nextDouble();
        double num3 = input.nextDouble();
        input.close();
        displaySortedNumbers(num1, num2, num3);
    }

    private static void displaySortedNumbers(double num1, double num2, double num3) {
        double big = Math.max(Math.max(num1, num2), num3);
        double small = Math.min(Math.min(num1, num2), num3);
        double middle = 0;
        if (num1 > small && num1 < big) {
            middle = num1;
        } else if (num2 > small && num2 < big) {
            middle = num2;
        } else {
            middle = num3;
        }
        System.out.println(small + " " + middle + " " + big);
    }
}
